
package com.weiyuwqj.server.service.invest.impl;

import com.github.pagehelper.PageHelper;
import com.weiyuwqj.server.service.invest.module.RepayModule;
import com.weiyuwqj.server.mapper.*;
import com.weiyuwqj.api.model.*;
import com.weiyuwqj.api.model.vo.PrepaymentVo;
import com.weiyuwqj.api.service.BusInvestRepayService;
import com.weiyuwqj.api.util.DateUtils;
import com.weiyuwqj.server.service.base.BaseServiceImpl;
import com.weiyuwqj.api.common.PageList;
import com.weiyuwqj.api.common.Paginator;
import com.weiyuwqj.api.model.vo.BusItemRepayVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by yxw on 2015/12/28.
 */
@Service("investRepayService")
public class BusInvestRepayServiceImp extends BaseServiceImpl<BusItemRepay> implements BusInvestRepayService {
    @Autowired
    BusItemRepayMapper repayMapper;

    @Autowired
    RepayModule repayModule;

    @Autowired
    BasItemMapper itemMapper;

    @Autowired
    BusVerifyLogMapper verifyLogMapper;

    @Autowired
    BusPrepaymentLogMapper prepaymentLogMapper;
    /**
     * 显示
     * @return
     */
    @Override
    public PageList getList(Paginator p, Map<String, Object> param) {
        PageHelper.startPage(p.getPageNum(), p.getPageSize());
        List<BusItemRepayVo> list = repayMapper.getList(param);
        return new PageList(list);
    }

    @Override
    public List<BusItemRepayVo> getList(Map<String, Object> param) {
        return repayMapper.getList(param);
    }

    @Override
    public List getRepayList(Map map) {
        return repayMapper.getRepayList(map);
    }

    @Override
    public Map statRepay(Map<String, Object> map) {
        return repayMapper.statRepay(map);
    }

    @Override
    public Map statNoRepay(Map<String, Object> map) {
        return repayMapper.statNoRepay(map);
    }

//    //借款人还款
//    @Override
//    public Map borrowerRepay(Integer itemId, Integer currentPeriod) {
//        return repayModule.borrowerRepay(itemId,currentPeriod);
//    }

//    //标的还款给投资人
//    @Override
//    public Map itemRepay(Integer itemId, Integer currentPeriod) {
//        return repayModule.itemRepay(itemId,currentPeriod);
//    }

    @Override
    public Map checkAccountStat(Map map) {
        return repayMapper.checkAccountStat(map);
    }

    @Override
    public List<BusItemRepay> getRepayListByItemId(Integer itemId) {
        return repayMapper.getRepayListByItemId(itemId);
    }

    @Override
    public Map statRepayByItemId(Integer itemId) {
        return repayMapper.statRepayByItemId(itemId);
    }
}
